# ------------------------------------------------------------------
# konrad.smolinski@gmail.com
#
# date: 		15/01/2010
# last update: 	25/01/2010
#
# info:
#	
# TO DO : Bisection search
# terurn outside point
# ------------------------------------------------------------------
lvlHit2D <- function(pt,criterion=NULL,step=c(0,0.01),plt=FALSE){
	if(is.null(criterion)) stop("Criterion function is required.")
	inside <- TRUE
	ptPrev <- pt
	ptNow <- pt
	
	while(inside){
		ptPrev <- ptNow
		ptNow <- ptNow+step
		inside <- criterion(ptNow)	
		if(plt) points(ptNow[1],ptNow[2],cex=0.1,pch=19,col="black")
	}
	
#return(ptNow-step)	
return(ptNow)		
}
# --- EOF ----------------------------------------------------------
